package util.designpattern.strategyPattern;

public class StrategyTest {

    public static void main(String[] args) {
        Context context = new Context(new ConcreteStrategyA());
        context.contextInterface();

        Context context1 = new Context(new ConcreteStrategyB());
        context1.contextInterface();

        Context context2 = new Context(new ConcreteStrategyC());
        context2.contextInterface();

        System.out.println("~~~~~~~~~~~~~~优化后的策略模式~~~~~~~~~~");

        String promotionKey = "GROUPBUY";

        Context context3 = new Context(PromotionStrategyFactory.getStrategy(promotionKey));
        context3.contextInterface();

        System.out.println("~~~~~~~~支付方式测试~~~~~~~~~~~~~");
        //省略把商品添加到购物车再从购物车下单，直接从订单开始
        Order order = new Order("1","202007081000002000111",324.5);

        System.out.println(order.pay(PayStrategy.ALI_PAY));
    }

}
